<?php defined('SYSPATH') or die('No direct script access.');

/**
 * Service Module Demo Controller
 *
 * $Id: service.php 122 2008-09-14 21:36:21Z alex.aperez $
 *
 * @package		Service Module
 * @author		Alex Sancho
 * @copyright	(c) 2008 Alex Sancho
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *	  notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *	  notice, this list of conditions and the following disclaimer in the
 *	  documentation and/or other materials provided with the distribution.
 * 3. Neither the name of copyright holders nor the names of its
 *	  contributors may be used to endorse or promote products derived
 *	  from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.	IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */


class Service_Controller extends Controller_Core
{
	const ALLOW_PRODUCTION = FALSE;
	
	protected $data = null;

	public function __construct()
	{
		parent::__construct();
		
		new Profiler;

		Event::add('system.post_controller', array($this, '_display'));
	}
	
	public function flickr()
	{
		$config = array
		(
			'driver' => 'Flickr'
		);
	
		$this->data = Service::instance($config)->people_get_upload_status();
	}
	
	public function delicious()
	{
		$config = array
		(
			'driver' => 'Delicious'
		);
	
		$this->data = Service::instance($config)->get_tags();
	}

	public function magnolia()
	{
		$config = array
		(
			'driver' => 'Magnolia'
		);
	
		$this->data = Service::instance($config)->get_tags();
	}

	public function gravatar()
	{
		$config = array
		(
			'driver' => 'Gravatar'
		);
	
		$this->data = Service::instance($config)->get_url();
	}
	
	public function audioscrobbler()
	{
		$config = array
		(
			'driver' => 'Audioscrobbler'
		);
	
		$this->data = Service::instance($config)->user_get_profile_information();
	}

	public function technorati()
	{
		$config = array
		(
			'driver' => 'Technorati'
		);
	
		$this->data = Service::instance($config)->key_info();
	}

	public function twitter()
	{
		$config = array
		(
			'driver' => 'Twitter'
		);
	
		$this->data = Service::instance($config)->get_public_timeline();
	}
	
	public function twitxr()
	{
		$config = array
		(
			'driver' => 'Twitxr'
		);
					
		$this->data = Service::instance($config)->get_public_timeline();
	}
	
	public function moo()
	{
		$config = array
		(
			'driver' => 'Moo'
		);
		
		$this->data = Service::instance($config)->add_design('http://farm3.static.flickr.com/2300/2179038972_23d2a1ff40_o.jpg')->get_xml();
	}

	public function tumblr()
	{
		$config = array
		(
			'driver' => 'Tumblr'
		);
	
		$this->data = Service::instance($config)->read();
	}

	public function vimeo()
	{
		$config = array
		(
			'driver' => 'Vimeo'
		);

		$this->data = Service::instance($config)->get_list();
	}

	public function _display()
	{
		$this->template = View::factory('service')->set('content', Kohana::debug($this->data))->render(true);
	}

} //End Service Controller